package com.train.chatspring.model;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import java.util.List;

/**
 * 用户实体类，映射到数据库中的 user 表
 */
@Entity
@Table(name = "user")
public class User {
    @Id
    @Column(name = "username", nullable = false, unique = true)
    private String username;

    @Column(name = "password", nullable = false)
    private String password;

    @Column(name = "friends", columnDefinition = "TEXT")
    private String friends; // 好友列表，JSON 格式存储

    // Getter for username
    public String getUsername() {
        return username;
    }

    // Setter for username
    public void setUsername(String username) {
        this.username = username;
    }

    // Getter for password
    public String getPassword() {
        return password;
    }

    // Setter for password
    public void setPassword(String password) {
        this.password = password;
    }

    // Getter for friends
    public String getFriends() {
        return friends;
    }

    // Setter for friends
    public void setFriends(String friends) {
        this.friends = friends;
    }
}